<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <title>alert弹出框</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../css/style/dialog.css" />
    <style>
        html,
        body {
            background: rgba(0, 0, 0, 0)
        }
    </style>
</head>

<body>
    <div class="mask"></div>
    <div class="index-popup" id="content">
        <!-- <p class="header">123</p>
        <p class="content">写有误酒店审核未通过</p> -->
        <!-- <span>
           <em class="onlyBtn"><input type="button" name="" value="游客页面" class="btn_inp btn2" style="width:50%"></em>
        </span> -->
        <!-- <span>
        	<em><input type="button" name="" value="游客页面" class="btn_inp btn1"></em>
            <em><input type="button" name="" value="重新验证" class="btn_inp btn2"></em>
        </span> -->
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/doT.min.js"></script>
<script type="text/javascript" src="../script/service/service-app.js"></script>

<script type="text/template" id="dialogCon">
    <p class="header">{{= it.title}}</p>
    <p class="content">{{= it.content}}</p>
    {{? it.btnNum == 1}}
    <span>
       <em class="onlyBtn"><button class="btn_inp btn2" style="width:50%" onclick="fnBtnClick3()" tapmode>{{= it.btnName3}}</button></em>
    </span> {{?? it.btnNum == 2}}
    <span>
        <em><button class="btn_inp btn1" onclick="fnBtnClick1()" tapmode>{{= it.btnName1}}</button></em>
        <em><button class="btn_inp btn2" onclick="fnBtnClick2()" tapmode>{{= it.btnName2}}</button></em>
    </span> {{?}}

</script>
<script type="text/javascript">
    var vTitle;
    var vContent;
    var vBtnText1;
    var vBtnText2;
    apiready = function() {
        fnInitPage();
    };
    //页面初始化
    function fnInitPage() {
        var tParam = {};
        var tTpl = $api.html($api.byId('dialogCon'));
        var tTplCon = $api.byId('content');
        tParam.title = api.pageParam.title ? api.pageParam.title : '';
        tParam.content = api.pageParam.content ? api.pageParam.content : '提醒';
        tParam.btnName1 = api.pageParam.btn1Text ? api.pageParam.btn1Text : '取消';
        tParam.btnName2 = api.pageParam.btn2Text ? api.pageParam.btn2Text : '确定';
        tParam.btnName3 = api.pageParam.btn3Text ? api.pageParam.btn3Text : '确定';
        tParam.btnNum = api.pageParam.btnNum;
        var tTplHtml = doT.template(tTpl)(tParam);
        console.log(tTplHtml)
        $api.html(tTplCon, tTplHtml);
        api.parseTapmode();
    }
    //点击按钮1的事件
    function fnBtnClick1() {
        if (api.pageParam.btn1FunName) {
            var tFunc = api.pageParam.btn1FunName + '()';
            api.execScript({
                name: api.pageParam.fromWinName,
                frameName: api.pageParam.fromFrmName,
                script: tFunc
            });
        }
        setTimeout(function() {
            api.closeFrame({
                name: api.frameName
            });
        }, 300)
    }
    //点击按钮2的事件
    function fnBtnClick2() {
        if (api.pageParam.btn2FunName) {
            var tFunc = api.pageParam.btn2FunName + '()';
            api.execScript({
                name: api.pageParam.fromWinName,
                frameName: api.pageParam.fromFrmName,
                script: tFunc
            });
        }
        setTimeout(function() {
            api.closeFrame({
                name: api.frameName
            });
        }, 300)
    }
    //点击按钮3的事件
    function fnBtnClick3() {
        if (api.pageParam.btn3FunName) {
            var tFunc = api.pageParam.btn3FunName + '()';
            api.execScript({
                name: api.pageParam.fromWinName,
                frameName: api.pageParam.fromFrmName,
                script: tFunc
            });
        }
        setTimeout(function() {
            api.closeFrame({
                name: api.frameName
            });
        }, 300)
    }
</script>

</html>
